home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / STDERRF.ZIP / STDERRF.DOC < prev    next >
Text File  |  1995-05-29  |  37KB  |  1,021 lines

  1.  
  2.  
  3.  
  4.                                        STDERRF
  5.  
  6.                              A STDERR Redirection Utility
  7.  
  8.                                      Version 1.00
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.                                      USER'S GUIDE
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.                                        MoonWare
  48.                               16005 Pointer Ridge Drive
  49.                                  Bowie, MD 20716-1744
  50.                                 raymoon@dgs.dgsys.com
  51.  
  52.  
  53.  
  54.                             Copyright   1995 Raymond Moon
  55.                                  ALL RIGHTS RESERVED
  56.  
  57.  
  58.  
  59.  
  60.  
  61.           
  62.           
  63.           LIMITED WARRANTY - STDERRF is provided AS IS.
  64.  
  65.           MoonWare makes no representations or warranties, expressed or im-
  66.           plied, about the contents hereof, including, without limitations,
  67.           any implied warranties of merchantability or fitness for a
  68.           particular purpose, all of which MoonWare expressly disclaims. 
  69.           Neither MoonWare, nor anyone involved in the distribution of this
  70.           software shall be liable for any direct, indirect, consequential,
  71.           or incidental damages arising out of the use, the results of use,
  72.           or inability to use such product even if I have been advised of
  73.           the possibility of such damages or claim.
  74.  
  75.  
  76.           USER'S GUIDE COPYRIGHT NOTICE
  77.  
  78.           Copyright (c) 1995 by Raymond Moon
  79.           ALL RIGHTS RESERVED
  80.  
  81.           Users for their personal use may reproduce this manual by print-
  82.           ing it or coping it onto disk for automated access.             
  83.  
  84.  
  85.           SOFTWARE COPYRIGHT NOTICE
  86.  
  87.           Copyright (c) 1995 by Raymond Moon
  88.           ALL RIGHTS RESERVED
  89.  
  90.           The STDERRF software is copyright (c) 1995 by Raymond Moon.  It may
  91.           be used without fee for non-commercial use.  Commercial use
  92.           requires prior written agreement of the author.
  93.  
  94.  
  95.           SOURCE CODE COPYRIGHT NOTICE
  96.  
  97.           Copyright (c) 1995 by Raymond Moon
  98.           ALL RIGHTS RESERVED
  99.  
  100.           The source code is copyright (c) 1995 by Raymond Moon.  The source
  101.           code, in part or whole, and any derivative work can be used
  102.           royalty free for non-commercial use as long as my copyright is
  103.           included in the documentation.  To distribute the source code, in
  104.           part or whole, and any derivative work must include my copyright
  105.           and source code restrictions and requires prior written agreement
  106.           of the author.
  107.  
  108.  
  109.           SHAREWARE DISTRIBUTION
  110.  
  111.           I have chosen this method of distributing the STDERRF software so
  112.           you, the user, can obtain and use STDERRF with a minimum of
  113.           inconvenience.  Users are authorized to upload the zip file,
  114.           STDERRF.ZIP, to any Internet Node providing shareware software
  115.           distribution or dial-up Bulletin Board System as long as the zip
  116.           file has not been modified. 
  117.  
  118.                                           ii
  119.  
  120.  
  121.  
  122.           CHARGES FOR DISTRIBUTION
  123.  
  124.           STDERRF cannot be sold without the author's prior written approv-
  125.           al.  If a third party distributes STDERRF on a diskette, which
  126.           third party can charge a small fee not to exceed $5.00 per
  127.           diskette or $30.00 for CD-ROM to cover the cost of the media and
  128.           any shipping costs.
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.                                          iii
  178.  
  179.                                   
  180.                                   
  181.                                   
  182.                                   TABLE OF CONTENTS
  183.  
  184.          INTRODUCTION  . . . . . . . . . . . . . . . . . . . . . . . . .  1
  185.              1.1  What is STDERRF  . . . . . . . . . . . . . . . . . . .  1
  186.              1.2  Summary of STDERRF Usage . . . . . . . . . . . . . . .  1
  187.              1.3  Hardware Requirements  . . . . . . . . . . . . . . . .  1
  188.              1.4  Printing this Manual . . . . . . . . . . . . . . . . .  2
  189.              1.5  User Responsibilities  . . . . . . . . . . . . . . . .  2
  190.              1.6  User Comments  . . . . . . . . . . . . . . . . . . . .  2
  191.  
  192.          BASICS  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3
  193.              2.1  STDERRF PURPOSE  . . . . . . . . . . . . . . . . . . .  3
  194.              2.2  STDERRF ALGORITHM  . . . . . . . . . . . . . . . . . .  3
  195.              2.3  STDERRF SOURCE FILES . . . . . . . . . . . . . . . . .  4
  196.              2.4  DETAILED DESCRIPTION OF SOURCE CODE FILES  . . . . . .  4
  197.                  2.4.1  Startup1.asm . . . . . . . . . . . . . . . . . .  4
  198.                  2.4.2  Stderrf.asm  . . . . . . . . . . . . . . . . . .  5
  199.                  2.4.3  Exit.asm . . . . . . . . . . . . . . . . . . . .  7
  200.                  2.4.4  Getvldc.asm  . . . . . . . . . . . . . . . . . .  7
  201.                  2.4.5  Stderrf.inc  . . . . . . . . . . . . . . . . . .  7
  202.                  2.4.6  Procesor.inc . . . . . . . . . . . . . . . . . .  7
  203.  
  204.          PRINTDOC  . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  205.             3.1  Using PRINTDOC  . . . . . . . . . . . . . . . . . . . .  8
  206.  
  207.          STDERRF ERROR MESSAGES  . . . . . . . . . . . . . . . . . . . .  9
  208.             4.1  Error Messages  . . . . . . . . . . . . . . . . . . . .  9
  209.             4.2  Non-DOS Related Error Messages  . . . . . . . . . . . .  9
  210.                 4.2.1  Usage . . . . . . . . . . . . . . . . . . . . . .  9
  211.                 4.2.2  STDERRF terminated at user's request  . . . . . .  9
  212.             4.3  DOS related Errors  . . . . . . . . . . . . . . . . . .  9
  213.                 4.3.1  Unable to duplicate STDERR filehandle . . . . . .  9
  214.                 4.3.2  Unable to create redirection file . . . . . . . . 10
  215.                 4.3.3  Unable to force STDERR to redirection filehandle
  216.                        . . . . . . . . . . . . . . . . . . . . . . . . . 10
  217.                 4.3.4  Unable to load and execute program  . . . . . . . 10
  218.                 4.3.5  Unable to restore STDERR  . . . . . . . . . . . . 11
  219.                 4.3.6  Unable to close redirection file  . . . . . . . . 11
  220.  
  221.          REGISTRATION  . . . . . . . . . . . . . . . . . . . . . . . . . 12
  222.             Registration Information . . . . . . . . . . . . . . . . . . 12
  223.             STDERRF Registration Form  . . . . . . . . . . . . . . . . . 13
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.                                           iv
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.                                      INTRODUCTION
  250.  
  251.           1.1  What is STDERRF
  252.           ====================
  253.  
  254.               STDERRF is an STDERR, standard error, redirection utility. 
  255.           The DOS command line only allows for redirection of STDOUT,
  256.           standard out, to be redirected from the screen to a file or
  257.           device.  This feature allows the software author to ensure that
  258.           certain messages that require human intervention are not redi-
  259.           rected into a file but displayed on the screen.  STDERRF will
  260.           force STDERR to be redirected to a file of the user s choice.
  261.  
  262.               STDERRF and its assembly language source code provides a
  263.           complete working example on redirecting STDERR to a file. 
  264.           STDERRF source code was too large to include it in the Frequently
  265.           Asked Questions (FAQ) for the alt.lang.asm and comp.lang.asm.x86
  266.           newsgroups.  Therefore, I have distributed it as Shareware so
  267.           that STDERRF is readily available to anyone who wants it.  This
  268.           program is meant to be an instructional not a commercial product. 
  269.  
  270.  
  271.           1.2  Summary of STDERRF Usage
  272.           ============================
  273.  
  274.           STDERRF FILENAME EXENAME [ COMMAND LINE ]
  275.  
  276.               where:
  277.                   FILENAME is the name of the file into which the user
  278.                       wants the STDERR to be redirected.  If the drive or
  279.                       path specified is not included, the file will be
  280.                       created in the default directory.  If the file ex-
  281.                       ists, STDERRF will ask the user whether to continue. 
  282.                       If the user wants to continue, STDERRF will ask if
  283.                       the file is to be truncated, i.e., contents
  284.                       overwritten, or the new output appended to the cur-
  285.                       rent contents.
  286.                   EXENAME is the file name and extension, the extension is
  287.                       required, of the program to execute
  288.  
  289.  
  290.           1.3  Hardware Requirements
  291.           ==========================
  292.  
  293.               IBM PC/XT/AT/PS/2 or 100% compatible personal computer
  294.               PC-DOS or MS-DOS 2.0 or higher
  295.               3K memory
  296.               80286 or better processor
  297.            
  298.  
  299.                                           1
  300.                                                                
  301.                                                                
  302.                                                                INTRODUCTION
  303.                                                                ============
  304.  
  305.  
  306.           1.4  Printing this Manual
  307.           =========================
  308.  
  309.               This User's Guide has been formatted so you can print it on
  310.           most LaserJets and DeskJets that print 60 lines per page and 10
  311.           cpi.  To print this User's Guide, use the following DOS command.
  312.  
  313.               COPY STDERRF.DOC PRN:
  314.  
  315.           This example assumes that STDERRF.DOC is in the default direc-
  316.           tory. 
  317.            
  318.               If your printer does not print 60 lines per page as shown by
  319.           the page breaks creeping up or down the page, see the section on
  320.           Using PRINTDOC, page 8.
  321.  
  322.  
  323.           1.5  User Responsibilities
  324.           ==========================
  325.  
  326.               As mentioned earlier, STDERRF is being distributed as Share-
  327.           Ware.  STDERRF is meant to provide a full working example of how
  328.           to redirect STDERR to a file.  While there is no request for
  329.           payment for non-commercial use, STDERRF is not released to the
  330.           Public Domain.  If you use my code or derive code from my code
  331.           for non-commercial purposes, you must include my copyright in
  332.           your source code and documentation, and include my restricted
  333.           rights for usage if the source code is published.  This is all I
  334.           ask.  If you want use my code or derive code for my code for
  335.           commercial purposes, you must register your copy.  See Registra-
  336.           tion, page 12  If you implement the algorithm without referring
  337.           to my code, no restrictions apply.
  338.  
  339.  
  340.           1.6  User Comments
  341.           ==================
  342.  
  343.               User comments are appreciated at any time.  Please send any
  344.           comments to:
  345.  
  346.                   raymoon@dgs.dgsys.com
  347.                       or
  348.                   Raymond Moon
  349.                   16005 Pointer Ridge Drive 
  350.                   Bowie, MD  20716-1744
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.                                           2
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.                                     STDERRF BASICS
  370.  
  371.  
  372.           2.1  STDERRF PURPOSE
  373.           ====================
  374.  
  375.               The purpose of STDERRF is to teach and not to be commercial
  376.           utility.  I did write a full featured utility so that you could
  377.           see a full and working implementation.  The source code can be
  378.           used for more than just learning how to redirect STDERR.  My
  379.           source code can show you how to have standardized startup code
  380.           that will provide command line arguments in argc and *argv[]
  381.           format just as in C.  Also, this source code illustrates how to
  382.           write a procedure that will assemble in any memory model. 
  383.           STDERRF.ASM also is a good example of how to load and execute
  384.           another program with all the supporting structures.  GETVLDC.ASM
  385.           is a general purpose library procedure that will return the
  386.           user s response to a question.  This procedure can go directly
  387.           into your library.  Lastly, EXIT.ASM shows any easy way to write
  388.           an error exit routine that lets the user know why the program is
  389.           terminating.
  390.  
  391.  
  392.           2.2  STDERRF ALGORITHM
  393.           ======================
  394.  
  395.               The basic algorithm for STDERRF is:
  396.  
  397.               1.  Accepts three command line arguments:
  398.                   a.  The full path and filename of the file into which
  399.                       STDERR is to be written.
  400.                   b.  The full path and filename of the program to be
  401.                       executed.
  402.                   c.  The command line for the program to be executed
  403.                       (should be delimited by double quotes to allow multi-
  404.                       ple arguments).  This  argument is optional.
  405.               2.  Releases all memory above the program using Int 21 func-
  406.                   tion 4ah so that there will be room enough to load and
  407.                   execute the designated program.
  408.               3.  Opens the file from step #1.a above into which STDERR is
  409.                   to be written.  If file exists, ask user to continue.  If
  410.                   to continue, ask user if the file is to be truncated or
  411.                   output appended.  Perform the requested actions.
  412.               4.  Duplicates STDERR filehandle using Int 21h function 45h.
  413.               5.  Uses Int 21h function 46h, force STDERR filehandle to
  414.                   have the filehandle of the opened file from step #2.
  415.               6.  Uses Int 21h function 4b00h to load and execute the
  416.                   program from step #1.a.  Use the default environment and
  417.                   the command line from step #1.c above.
  418.  
  419.                                           3
  420.                                                            
  421.                                                            
  422.                                                            STDERRF BASICS
  423.                                                            ==============
  424.  
  425.               7.  Upon return from the function 4b00h, closes the file
  426.                   opened in step #2.
  427.  
  428.               8.  Restores STDERR using Int 21h function 46h to force
  429.                   STDERR to point to the filehandle saved from step #3
  430.                   above.
  431.  
  432.  
  433.           2.3  STDERRF SOURCE FILES
  434.           =========================
  435.  
  436.               The STDERRF source files with general descriptions are:
  437.  
  438.                   STARTUP1.ASM    General Purpose ASM Startup Code
  439.                                       Used to parse command line and
  440.                                       Free up memory above the program
  441.                   STDERRF.ASM     Main Procedure for STDERRF
  442.                                       Implements the basic algorithm
  443.                   STDERRF.INC     Include file for all STDERRF source
  444.                                       files.
  445.                   GETVLDC.ASM     Library procedure to get a user s 
  446.                                       response to a question.
  447.                   EXIT.ASM        STDERRF abnormal termination
  448.                                       procedure.
  449.                   PROCESOR.INC    Ensures all files assembled for the
  450.                                       same processor.   
  451.  
  452.           STARTUP1.ASM implements steps #1 and #2 of the algorithm. 
  453.           STDERRF.ASM implements steps #3 through #8.
  454.  
  455.  
  456.           2.4  DETAILED DESCRIPTION OF SOURCE CODE FILES
  457.           ==============================================
  458.  
  459.           2.4.1  Startup1.asm
  460.           -------------------
  461.  
  462.           As stated above, this is one of my standard assembly startup
  463.           procedures.  This startup code performs the following functions:
  464.  
  465.               1.  Parses the command line into argc and *argv[] similar to
  466.           C.  Argv[0] is the first command line argument not the program 
  467.           name as in C.
  468.               
  469.               2.  Initializes the following global variables:
  470.                   a.  DGRP, segment address of DGROUP
  471.                   b.  STACK_BOTTOM, offset to stack bottom in DGROUP
  472.                   c.  PSP, segment address of PSP
  473.                   d.  ENVIRON, segment address of passed copy of the ENVI-
  474.                       RONMENT
  475.                   e.  OSMAJOR, integer part of OS system
  476.                   f.  OSMINOR, decimal part of OS system
  477.  
  478.                                           4
  479.                                                            
  480.                                                            
  481.                                                            
  482.                                                            STDERRF BASICS
  483.                                                            ==============
  484.  
  485.               3.  If DOS version is less than 2.0, aborts with error mes-
  486.                   sage.
  487.               4.  Initializes DS and ES segment registers to DGROUP.
  488.               5.  Shrinks memory down to size of program by releasing all
  489.                   memory above program.
  490.  
  491.           This procedure is one of a set of startup code range from the
  492.           very simple to the one above this one that also parses the
  493.           environmental strings.  By mid-summer 1995, I should have all the
  494.           procedures available.
  495.  
  496.           2.4.2  Stderrf.asm
  497.           ------------------
  498.  
  499.           This procedure is the heart of this program.  As stated above,
  500.           this procedure implements steps #3 through to the end of the
  501.           algorithm.
  502.  
  503.           STDERRF.ASM starts executing by telling the user who it is. 
  504.           Then, it checks to see that there are at least two command line
  505.           arguments, the redirection file and the program to execute.  If
  506.           there is not at least two arguments, the program displays an
  507.           error message and terminates.
  508.  
  509.           The next step is the first that implements the algorithm.  A
  510.           duplicate file handle for STDERR is created.  To be a well
  511.           behaved program, STDERR needs to be restored at the end of the
  512.           program so a copy of it must be saved.  I save it to a global
  513.           variable because the EXIT procedure checks to see if it is zero. 
  514.           If it is not zero, the EXIT procedure will know that STDERR has
  515.           not been restored and will attempt restore it.
  516.  
  517.           The next step is to initialize the command tail for the program
  518.           to be executed.  The command tail is copied into the last 128
  519.           bytes of the PSP of the program to be executed.  I created a
  520.           structure to make the addressing of its various parts easier. 
  521.           The structure is:
  522.  
  523.           CommandTail_S   struc
  524.           ctLength        db  ?   ; Length of command tail minus end CR
  525.           ctLeadingSpace  db  ?   ; Initial space to start command tail
  526.           ctText          db  126 dup (?) ; Command Tail
  527.           CommandTail_S   ends
  528.  
  529.           The first byte is the length of the command tail which does not
  530.           include the terminating carriage return.  The command tail starts
  531.           with a space; this is the space between the end of the filename
  532.           typed in at the DOS prompt and the first command line argument. 
  533.           Microsoft recommends that a space be placed there, and I have
  534.           followed their recommendation.  That leaves 126 bytes for the
  535.           command line.  My code does not check the length because the
  536.           command line for the executed program is one of three command
  537.  
  538.                                           5
  539.                                                            
  540.                                                            
  541.                                                            
  542.                                                            STDERRF BASICS
  543.                                                            ==============
  544.  
  545.           line arguments so it must be less than 126.  The code should be
  546.           straight forward.  I load the bytes one at a time and count each
  547.           one.  At the end, I terminate the string with a carriage return
  548.           and store the length in the first byte.
  549.  
  550.           The next nine blocks deal with opening the file into which STDERR
  551.           will be redirected.  I first try to open the file to see if the
  552.           file already exists.  If the file does exist, STDERRF asks the
  553.           user if he wants to continue.  If the user wants to continue,
  554.           STDERRF asks the user if the redirection is to be appended or
  555.           overwritten.  Based upon the user s response, the read/write
  556.           pointer is moved to the end of the file or the start of the file
  557.           and zero bytes written.  If the file does not exist, it is
  558.           created.
  559.  
  560.           Now, the next block forces STDERR to have the filehandle of the
  561.           just opened file.  When STDERRF opened the file, the
  562.           NO_INHERITANCE flag was not set.  Therefore, when STDERRF loads
  563.           and executes the target program, that program will inherit STDERR
  564.           pointing to the file vice to the console.
  565.  
  566.           Everything is now set to load and execute the desired program. 
  567.           The next block does this.  Now I need to explain the ParamBlk
  568.           structure.  This structure is defined as:
  569.  
  570.           LoadExec_S  struc
  571.           leEnvironment   dw      ?   ; Environment block segment address
  572.           leCommandTail   LPtr    <>  ; Address of Command Tail
  573.           leFCB_1         LPtr    <>  ; address of default FCB, #1
  574.           leFCB_2         LPtr    <>  ; address of second FCB, #2
  575.           LoadExec_S  ends
  576.  
  577.           (The LPtr is another structure that allow me to address the
  578.           segment and offset portions of a long pointer independently.)
  579.  
  580.           The initialization of this structure is done in the .DATA seg-
  581.           ment.  leEnvironment is set to 0 so that STDERRF s environment is
  582.           used.  This variable provides you with the capability to define a
  583.           tailored environment for the executed program.  The command tail
  584.           is explained above.  The last two entries are the default and
  585.           second File Control Blocks (FCBs).  Again, Microsoft recommends
  586.           that these FCBs be initialized to blank FCBs.  A minimum blank
  587.           FCB is defined as:
  588.  
  589.           EmptyFCB    db  11 dup (20h), 5 dup (00h)
  590.  
  591.           You can see that both FCBs are initialized to the same empty FCB.
  592.  
  593.           If the load and execute is successful, STDERRF restores STDERR by
  594.           forcing it to point to the saved filehandle for STDERR.  Then the
  595.           redirected file is closed, and STDERRF terminates by returning
  596.           the exit code of the executed program.
  597.  
  598.                                           6
  599.                                                            
  600.                                                            
  601.                                                            
  602.                                                            STDERRF BASICS
  603.                                                            ==============
  604.  
  605.           2.4.3  Exit.asm
  606.           ---------------
  607.  
  608.           While this is not a standard library routine of mine, it is a
  609.           regular procedure in all my programs.  This procedure follows the
  610.           same format.  When I encounter a terminal error in some part of
  611.           the program, I call this procedure with an equate stored in the
  612.           AX that identifies the error type.  The EXIT procedure uses this
  613.           value as an index into arrays that store the address and length.
  614.  
  615.           2.4.4  Getvldc.asm
  616.           ------------------
  617.  
  618.           This is a standard library procedure.  It is actually new in that
  619.           I modified an earlier procedure that was hard coded for the
  620.            (y/n)  response.  Now, it is a general procedure.  In fact, my
  621.           first interaction had one question to the user as  truncate or
  622.           append? (t/a):  .  Looking at it, I realized that it should be
  623.            overwrite or append? (o/a):  .  The modification was just in the
  624.           string variable that contained the question and passed valid
  625.           choices in STDERRF.ASM.  No changes were required in GETVLDC.ASM. 
  626.           This is how procedures should be written.
  627.  
  628.           2.4.5  Stderrf.inc
  629.           ------------------
  630.  
  631.           There is nothing unique there.  I just have combined equates,
  632.           macro, etc. used in two or more procedures in this include file. 
  633.           This ensures that the information is uniform in all source files.
  634.  
  635.           2.4.6  Procesor.inc
  636.           -------------------
  637.  
  638.           This include file contains only the processor directive.  Again,
  639.           using this include file ensures that all files are processed
  640.           using the same processor instruction set.  It also provides a
  641.           single location to modify to change the processor.
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.                                           7
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.                                        PRINTDOC
  669.  
  670.  
  671.           3.1  Using PRINTDOC
  672.           ===================
  673.  
  674.               If you have a LaserJet or DeskJet printer set to other than
  675.           60 lines per page, you may need to use PRINTDOC to print a copy
  676.           of this manual. 
  677.  
  678.               How do you know that you need to use PRINTDOC.  When you
  679.           printed this manual using the DOS COPY command, the page breaks
  680.           creep down the page.
  681.  
  682.               First you must determine in which direction and how many
  683.           lines the offset is.  Find pages 5, 6, and 7.  The top of each of
  684.           these pages starts with a header, STDERRF BASICS with double
  685.           underline, flush on the right margin.  Count the number of lines
  686.           this header is shifted.  Add this number to 60.  This is the
  687.           number to put on PRINTDOC's command line.
  688.  
  689.               Make sure that STDERRF.DOC is present in the default directo-
  690.           ry with PRINTDOC.  Print this manual by using the following
  691.           command line:
  692.  
  693.               PRINTDOC xx
  694.  
  695.                   where xx is the number you determined above.  Only values
  696.           between 61 and 84 are valid.
  697.  
  698.               All PRINTDOC does is to adjust the top margin.  It cannot be
  699.           use to print this manual on less pages by using legal sized
  700.           paper.
  701.  
  702.               For values of 66 and less, PRINTDOC will split the difference
  703.           between the top and bottom margins.  For values above 66,
  704.           PRINTDOC keeps a one inch top margin, that is six lines, and puts
  705.           the excess lines into the bottom margin.
  706.  
  707.               PRINTDOC directs the printed output to the DOS PRN: device. 
  708.           If your printer is connected to any other port than LPT1:, you
  709.           must use the DOS MODE command to redirect the output to that
  710.           port.  See your DOS manual on how to do this. 
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.                                           8
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.                                 STDERRF ERROR MESSAGES
  729.  
  730.  
  731.           4.1  Error Messages
  732.           ===================
  733.  
  734.               STDERRF displays two different types of error messages.  The
  735.           first type is displayed when a non-DOS related error condition
  736.           occurs.  The second is displayed when the error is DOS related. 
  737.           Error Messages are displayed on the screen when STDERRF must
  738.           terminate due to an unrecoverable condition or at user direction.
  739.  
  740.           4.2  Non-DOS Related Error Messages
  741.           ===================================
  742.  
  743.           The following error messages are the non-DOS related messages
  744.           with an explanation for when they occur.
  745.  
  746.           4.2.1  Usage
  747.           -----------
  748.  
  749.           The usage message which explains the basic command line options
  750.           is displayed whenever the number of command line arguments is
  751.           less than two, the minimum allowed.  This is a quick way to
  752.           display the help when the program is executed without any command
  753.           line arguments.
  754.  
  755.           4.2.2  STDERRF terminated at user's request
  756.           -------------------------------------------
  757.  
  758.           This message is displayed when the file exists into which STDERR
  759.           was to be redirected and the user requested for STDERRF to
  760.           terminate.
  761.  
  762.  
  763.           4.3  DOS related Errors
  764.           =======================
  765.  
  766.           DOS related error messages display information on the nature of
  767.           the error and the error was the result of a failed DOS call. 
  768.           Read the error message explanation and take to appropriate action
  769.           to correct the problem and try again.
  770.  
  771.           4.3.1  Unable to duplicate STDERR filehandle
  772.           --------------------------------------------
  773.  
  774.           This message is displayed when STDERRF can not create a duplicate
  775.           filehandle for STDERR.  This duplicate filehandle is required so
  776.           that STDERR can be restored when STDERRF terminates.
  777.  
  778.                                           9
  779.                                                    
  780.                                                    
  781.                                                    
  782.                                                    STDERRF ERROR MESSAGES
  783.                                                    ======================
  784.  
  785.           DOS error codes are:
  786.               04h - Too Many Open Files.  Since STDERRF at this point has
  787.                   only five standard files open and 20 files are available
  788.                   to programs, the limit must be in total files opened. 
  789.                   Close some applications, or, at least, the files opened
  790.                   in other applications, and try again.
  791.               06h - Invalid Handle.  STDERR was not available to STDERRF. 
  792.                   STDERRF is a child program of another application that
  793.                   has closed STDERR.  Execute STDERRF from the DOS command
  794.                   line.
  795.  
  796.           4.3.2  Unable to create redirection file
  797.           ----------------------------------------
  798.  
  799.           STDERRF could not create the file into which STDERR was to be
  800.           redirected.  The following DOS error codes are possible.
  801.               03h - Path Not Found.  Check the path specified for the
  802.                   redirection file as DOS could not find it.  Correct and
  803.                   try again.
  804.               04h - Too Many Open Files.  Since STDERRF at this point has
  805.                   only five standard files and one other file open and 20
  806.                   files are available to programs, the limit must be in
  807.                   total files opened.  Close some applications, or, at
  808.                   least, the files opened in other applications, and try
  809.                   again.
  810.               05h - Access Denied.  The redirection file already exists in
  811.                   the specified path and is read-only or the file was to be
  812.                   created in the root directory which was full.  Change the
  813.                   path of filename and try again.
  814.  
  815.           4.3.3  Unable to force STDERR to redirection filehandle
  816.           -------------------------------------------------------
  817.  
  818.           STDERRF could not force the STDERR filehandle to the value of the
  819.           open redirection filehandle.  DOS error codes are:
  820.               04h - Too Many Open Files.  Since STDERRF at this point has
  821.                   only five standard files open and 20 files are available
  822.                   to programs, the limit must be in total files opened. 
  823.                   Close some applications, or, at least, the files opened
  824.                   in other applications, and try again.
  825.               06h - Invalid Handle.  Something has corrupted STDERRF data. 
  826.                   This error should not occur.
  827.  
  828.           4.3.4  Unable to load and execute program
  829.           -----------------------------------------
  830.  
  831.           STDERRF could not load and execute the specified application. 
  832.           The possible DOS errors are:
  833.               01h - Invalid Function.  This error should not occur.  If it
  834.                   has something as corrupted STDERRF code segment.  Try
  835.                   again.  If error persists, remove other applications and
  836.                   try again.
  837.  
  838.                                           10
  839.                                                    
  840.                                                    
  841.                                                    
  842.                                                    STDERRF ERROR MESSAGES
  843.                                                    ======================
  844.  
  845.               02h - File Not Found.  Check the spelling of the file to
  846.                   execute.  Check the drive and path if used.  Try again.
  847.               03h - Path Not Found.  Check the spelling of the drive and
  848.                   path.  Try again.
  849.               04h - Too Many Open Files.  Since STDERRF has not exhausted
  850.                   the 20 filehandles normally available, the limit must be
  851.                   in total files opened.  Close some applications, or, at
  852.                   least, the files opened in other applications, and try
  853.                   again.
  854.               05h - Access Denied.  I do not know under what conditions
  855.                   that this error code is returned.  If this error occurs
  856.                   and is repeatable, please contact the author with the
  857.                   circumstances.
  858.               08h - Not Enough Memory.  Since STDERRF releases all memory
  859.                   above it, there still was not enough to load and execute
  860.                   the desired program.  Remove any TSRs and try again.
  861.               0ah - Bad Environment.  This error should not occur as
  862.                   STDERRF uses the passed environment.
  863.               0ch - Bad Format.  I am not sure under what conditions that
  864.                   this error code is returned.
  865.  
  866.           4.3.5  Unable to restore STDERR
  867.           -------------------------------
  868.  
  869.           This error should not occur.  If this error occurs and is repeat-
  870.           able, please contact the author with the circumstances. 
  871.  
  872.           4.3.6  Unable to close redirection file
  873.           ---------------------------------------
  874.  
  875.           This error should not occur.  If this error occurs and is repeat-
  876.           able, please contact the author with the circumstances.     
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.                                           11
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.                                      REGISTRATION
  909.  
  910.           Registration Information
  911.  
  912.           Mail the registration to:
  913.  
  914.               Raymond Moon
  915.               16005 Pointer Ridge Drive
  916.               Bowie, MD 20716-1744
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.                                           12
  959.                                                              
  960.                                                              
  961.                                                              
  962.                                                              REGISTRATION
  963.                                                              ============
  964.  
  965.                        STDERRF Non-Commercial Registration Form
  966.  
  967.  
  968.           Name: __________________________________________________________
  969.  
  970.  
  971.           Company: _______________________________________________________
  972.  
  973.  
  974.           Address: _______________________________________________________
  975.  
  976.  
  977.           City, State & Zip: _____________________________________________
  978.  
  979.  
  980.           Registration
  981.  
  982.  
  983.                   Basic One Computer Registration ($5.00) . . .                                                                 $__________
  984.  
  985.  
  986.                   Multiple Computer License ($1.00 each)  . . .                                                                 $__________
  987.  
  988.  
  989.  
  990.                                                           TOTAL $__________
  991.  
  992.           Comments:
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.                                           13
  1019.  
  1020.  
  1021.